package com.cefa.finance.dao;

import com.cefa.finance.model.Contract;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@SuppressWarnings("ALL")
@Repository
@Transactional
public interface ContractRepository extends CrudRepository<Contract,Long> {

    @Query(value = "select * from cefa_finance_contract where phone=?1", nativeQuery = true)
    Iterable<Contract> findByTenantryPhone(String phone);

    @Query(value = "select * from cefa_finance_contract where block_status is not true", nativeQuery = true)
    List<Contract> findUnBlockedContracts();
}
